package com.beiming.libra.controller;

import javax.annotation.Resource;
import javax.validation.Valid;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.beiming.libra.common.page.PageResult;
import com.beiming.libra.domain.dto.requestdto.PapersTemplateRequestDTO;
import com.beiming.libra.domain.dto.responsedto.PapersTemplateResponseDTO;
import com.beiming.libra.helper.Result;
import com.beiming.libra.service.PapersTemplateService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
 * 
 * @author weibo
 *
 */
@RestController
@Api(value = "文书模板", tags = "文书模板")
@RequestMapping("/api/papers")
public class PapersTemplateController {

  private static final Logger LOGGER = LoggerFactory.getLogger(PapersTemplateController.class);
  @Resource
  private PapersTemplateService papersTemplateService;

  /**
   * 获取文书模板列表
   */
  @ApiOperation(value = "获取文书模板列表（分页）", notes = "获取文书模板列表（分页）")
  @RequestMapping(value = "list", method = RequestMethod.POST)
  @ResponseBody
  public Result<PageResult<PapersTemplateResponseDTO>> listPapers(@RequestBody @Valid PapersTemplateRequestDTO dto) {
    PageResult<PapersTemplateResponseDTO> pageResult = papersTemplateService.listPapersTemplate(dto);
    return Result.success(pageResult);
  }
}
